//获取用户临时id
import { v4 as uuidv4 } from 'uuid';


function getUserTempId(){
  //先从localstorage取，没有创建新的，放入localStorage
  let userTempId = localStorage.getItem('userTempId_key');//没有返回null
  if (!userTempId) {
    userTempId =  uuidv4(); // ⇨ '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d'
    localStorage.setItem('userTempId_key',userTempId);
    return userTempId;
  }
  return userTempId;
}

//记得暴露呀
export default getUserTempId;